<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>任教课程-云校通-教师</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
<body ontouchstart style="background:#fff;">
	<div class="weui_tab tab-bottom">
		<div class="weui-header bg-blue"> 
	  		<div class="weui-header-left"> <a onclick="back()" href="javascript:" class="icon icon-109 f-white">返回</a> </div>
	    	<h1 class="weui-header-title">任教课程</h1>
	    </div>
		<div class="weui_tab_bd">
		    <div class="weui_cells afterNone mt0 pb55">
		    	<div class="weui_cell" id="signLine" style="padding: 10px 0px;">
		            <div class="page-bd" style="width: 100%;">
		              <ul>
		              	<c:forEach var="item" items="${list }">
			              	<li class="border-bottom1">
			                    <div class="weui-header weui-flex js-category" data-id="${item.id }">
			                        <img src="<%=basePath %>/images/wderjbj@3x.png">
			                        <p class="weui-flex-item">${item.courseName }</p>
			                        <i class="icon icon-74"></i>
			                    </div>
			                    <div class="page-category js-categoryInner">
					                
					            </div>
			                </li>
		              	</c:forEach>
		              </ul>
		            </div>
		          </div>
		    </div>
		</div>
	</div>
	
	<!--弹窗-->				
	<div class="weui_mask ueureiu weui_mask_visible" style="display: none;">
	</div>
	<div class="weui_dialog ueureiu weui_dialog_visible" style="display: none;">
	
		<div class="weui_dialog_bd" style="padding: 0;">
			
			<div class="weui_panel weui_panel_access">
	            <div class="weui_panel_bd" id="telList">
	            </div>
	        </div>
		</div>
	
	</div>
	<!--End弹窗-->
</body>
<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {
		$('.js-category').click(function(){
			$parent = $(this).parent('li');
            if($parent.hasClass('js-show')){
                $parent.removeClass('js-show');
                $(this).children('i').removeClass('icon-35').addClass('icon-74');
            }else{
                $parent.siblings().removeClass('js-show');
                $parent.addClass('js-show');
                $(this).children('i').removeClass('icon-74').addClass('icon-35');
                $parent.siblings().find('i').removeClass('icon-35').addClass('icon-74');
                getStuList($(this));
            }
	     });
		//隐藏弹出框
		$(".weui_mask").click(function(){
			$(".weui_mask").hide();
			$(".weui_dialog").hide();
			$("#telList").html('');
		});
	})
	function getStuList(thiz) {
    	if(thiz.next().html().trim() != '') return;
    	$.ajax({
   	 		url : basePath + "/ls/interest/course/teachingCourse/stuList",
   	 		type : "post",
   	 		dataType : "json",
   	 		data: {
   	 			courseId: thiz.attr("data-id")
   	 		},
   	 		async : false,
   	 		success : function(data) {
   	 				var map = data.data;
   	 				var html = '<ul>';
   	 				for(var i in map) {
	   	 				html+='<li class="border-bottom2">\
	                    <div class="page-category js-categoryInner">\
		                    <div class="weui_cells weui_cells_access bg_gry mt0">\
								<div class="weui_cell lblue afterNone afterNoneBefore bg_gry b_left">\
									<div class="weui_cell_bd weui_cell_primary"><p>'+i+'学生列表</p></div>\
								</div>';
	                    for(var j in map[i]) {
	                    	var itm = map[i][j];
	                    	html+= '<div class="weui_cell bg-white clear">\
		   	 					<div class="weui_cell_bd weui_cell_primary f-15">\
			   	 					<p class="xcgl_student_wrap">\
		   	 							<span style="width: 50%;">'+itm.gradeName+'（'+itm.clazz+'）班</span>\
		   	 							<span style="width: 10%;">'+itm.studentNum+'</span>\
		   	 							<span style="width: 30%;">'+itm.studentName+'</span>\
		   	 							<a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary"></a>\
		   	 						</p>\
			   	 				</div>\
			   	 			</div>';
	                    }
	                    html+='</div></div></li>';
   	 				}
	            	html+='</ul>';
   	 				thiz.next().html(html);
   	 		}, error:function(){
  	 			$.toptips("查询异常");
     		}
	 	});
	}
	function classDate(thiz) {
		$parent = $(thiz).parent('li');
        if($parent.hasClass('js-show')){
            $parent.removeClass('js-show');
            $(thiz).children('i').removeClass('icon-35').addClass('icon-74');
        }else{
            $parent.siblings().removeClass('js-show');
            $parent.addClass('js-show');
            $(thiz).children('i').removeClass('icon-74').addClass('icon-35');
            $parent.siblings().find('i').removeClass('icon-35').addClass('icon-74');
            getStuList($(thiz));
        }
	}
</script>
</html>